<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        ul{
            display: flex;
            flex-wrap: wrap;
            justify-content: space-between;
            align-content: center;
            width: 200px;
            margin: 100px auto;
            /* height: 200px; */
            /* background-color: antiquewhite; */
        }
        li{
            list-style: none;
            background-color:rgb(44, 18, 171);
            /* flex: 20%; */
            width: 24px;
            height: 24px;
            text-align: center;
            margin: 5px 10px;
            background: url(/pink/imgs/sprite.png) no-repeat;
        }
    </style>
</head>
<body>
    <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>
    <script>
        var lis=document.querySelectorAll('li')
        for(let i=0;i<lis.length;i++){
            var index=i*44;
            lis[i].style.backgroundPosition='0 -'+index+'px'
        }
    </script>
</body>
</html>